GetAddrByHost

Syntax:

object.GetAddrByHost HostName, IPAddress

 

Parameters:

object

An object expression that evaluates to a WSResolver object

HostName

A string variable that represents the network hostname to resolve to an IP address.

IPAddress

A string variable that will be filled in by the object. It will represent either the IP address (in dotted format), or a string containing the word 'Error' and an errorcode.

Remarks:

Call this method to resolve a hostname to an IP address.

The string variable IPAddress must be initialized prior to calling the method. In Visual C++, this means that you must first allocate memory for the string before passing in the LPSTR. In Visual Basic, this means creating a string variable of fixed length (see the example below).

Example:

' Be sure to add the 'Resolver 1.0 type library' to your list of references

' Create the WSResolver object:
Dim objResolver As New WSResolver
 
' Create our string (to be filled in by
' the object -- it will contain our IP address
' or a string containing the word 'Error' and an
' errorcode
Dim sTempString As String * 255
 
' Call the method on the object (we're looking
' for the host named 'azissql', but you could easily
' substitute 'www.microsoft.com')
objResolver.GetAddrByHost "azissql", sTempString
 
' print the string to the debug window
Debug.Print sTempString

' call release on the COM object:
Set objResolver = Nothing